#ifndef RD_MESSAGE_H2
#define RD_MESSAGE_H2
#include "extdef.h"
#include "rdProto.h"

namespace qb {

class SSPROTOAPI rdMessage {
 public:
  rdMessage(char* buff, int len);
  ~rdMessage();
  static void Init(char* key);
  static void SetPack(bool crc, bool encryt, bool zip);
  static int iUnPack(char* in, int in_len, char* out, int* out_len);
  static bool bPack(char* head, int h_len, char* body, int b_len, char* out,
                    int* out_len);
  static bool bPack2(char* head, int h_len, char* body, int b_len, char* out,
                     int* out_len);
  static bool bPack3(char* head, int h_len, char* body, int b_len, char* out,
                     int* out_len);
  static bool bCheckCRC(char* in, int in_len, char* out, int* out_len);
  static bool bPackCRC(char* in, int in_len, unsigned int* out, int* out_len);
  static bool bEncryt(char* in, int in_len, char* out, int* out_len,
                      char* in_key = NULL);
  static bool bDecryt(char* in, int in_len, char* out, int* out_len,
                      char* in_key = NULL);
  static bool bZip(char* in, int in_len, char* out, int* out_len);
  static bool bUnZip(char* in, int in_len, char* out, int* out_len);
  static bool UnCompress(char* in, int in_len, char* out, int* out_len,
                         int totallen);
};

}  // namespace qb

#endif
